package footprint.kwlee.app;

import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import footprint.kwlee.app.db.*;

public class BigDialogAdapter extends BaseAdapter {
	private LayoutInflater inflater;
	private List<BigItem> list;
	private Context context;
	
	public BigDialogAdapter(Context context, List<BigItem> list) {
		inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.list = list;
		this.context = context;
		
	} 
	
	public int getCount() {
		return list.size();
	}

	public Object getItem(int position) {
		return list.get(position);
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		int res = 0;
		if(convertView == null)
			convertView = inflater.inflate(R.layout.big_dialog_layout, parent, false);
		
		BigItem data = list.get(position);
			
		ImageView image = (ImageView) convertView.findViewById(R.id.ImageView3_01);
		TextView big_name = (TextView) convertView.findViewById(R.id.TextView3_01);
		TextView big_date = (TextView) convertView.findViewById(R.id.TextView3_02);
	
		big_name.setText(data.getBig_subject());
		big_date.setText(data.getBig_startdate() + " ~ " + data.getBig_enddate());
		if(data.getBig_image() != null)
			image.setImageDrawable(data.getBig_image());
		else
			image.setImageResource(R.drawable.noimage); 
		
		
		return convertView;
	}

}
